<!DOCTYPE HTML>
<html>
<head>
<title>Purple_loginform Website Template | Home :: w3layouts</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery.min.js"></script>
	<script src="js/jquery.form.js"></script>
<!-- -->
</head>
<body>
<!-- contact-form -->	
<div class="message warning">
<div class="inset">
	<div class="login-head">
		<h1>Login Form</h1>
		 <div class="alert-close"> </div> 			
	</div>
		<form id="loginForm" name="loginForm" action="/userLogin">
			<li>
				<input type="text" class="text" id="username" name="username"><a href="#" class=" icon user"></a>
			</li>
				<div class="clear"> </div>
			<li>
				<input type="password" id="password" name="password"> <a href="#" class="icon lock"></a>
			</li>
			<div class="clear"> </div>
			<div class="submit">
				<input id="submit" value="Sign in" style="text-align:center"/>
				<h4><a href="#">Lost your Password ?</a></h4>
				<div class="clear">  </div>
			</div>
		</form>
		</div>					
	</div>
	</div>
	<div class="clear"> </div>
<!--- footer --->
<div class="footer">
	<p>Copyright &copy; 2014.</p>
</div>
	<script>
		$('#submit').click(function () {
			login();
		});

		var submitOptions = {
			type: "POST",
			dataType: "text",
			error: function (data) {
				alert('登录失败')
			}, success: function (data) {
			console.log(data);
			window.location.href = "/app/index.html";
		}
		};

		var login = function(){
			$("#loginForm").ajaxSubmit(submitOptions);
		}
	</script>
</body>
</html>